<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Class: RemoteVirtualNode</title>

	<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

	<script src="./js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="./js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="class">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="./remotevirtualnode_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="remotevirtualnode.rb">remotevirtualnode.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			
			<div id="parent-class-section" class="section">
				<h3 class="section-header">Parent</h3>
				
				<p class="link"><a href="AbstractVirtualNode.html">AbstractVirtualNode</a></p>
				
			</div>
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-c-new">::new</a></li>
					
					<li><a href="#method-i-find_successor">#find_successor</a></li>
					
					<li><a href="#method-i-get_item">#get_item</a></li>
					
					<li><a href="#method-i-get_pred_list">#get_pred_list</a></li>
					
					<li><a href="#method-i-get_succ_list">#get_succ_list</a></li>
					
					<li><a href="#method-i-insert_item">#insert_item</a></li>
					
					<li><a href="#method-i-join">#join</a></li>
					
					<li><a href="#method-i-notify">#notify</a></li>
					
					<li><a href="#method-i-ping">#ping</a></li>
					
					<li><a href="#method-i-remove_item">#remove_item</a></li>
					
					<li><a href="#method-i-update_succ_list">#update_succ_list</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
		</div>

		<div id="project-metadata">
			
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="./images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="./Chorb.html">Chorb</a></li>
				
					<li><a href="./Chorb/Chord.html">Chorb::Chord</a></li>
				
					<li><a href="./AbstractVirtualNode.html">AbstractVirtualNode</a></li>
				
					<li><a href="./Key.html">Key</a></li>
				
					<li><a href="./ListenerVirtualNode.html">ListenerVirtualNode</a></li>
				
					<li><a href="./LocalVirtualNode.html">LocalVirtualNode</a></li>
				
					<li><a href="./RemoteVirtualNode.html">RemoteVirtualNode</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="class">RemoteVirtualNode</h1>

		<div id="description">
			<p>
Implementa a interface basica definida em <a
href="AbstractVirtualNode.html">AbstractVirtualNode</a> de tal forma a
representar um no&#8217; remoto. Isso e&#8217; feito usando DRuby como
mecanismo de chamada remotada.
</p>

		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		
		<div id="attribute-method-details" class="method-section section">
			<h3 class="section-header">Attributes</h3>

			
			<div id="port-attribute-method" class="method-detail">
				<a name="port"></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">port</span><span
						class="attribute-access-type">[R]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
			<div id="host-attribute-method" class="method-detail">
				<a name="host"></a>
				
				<a name="host="></a>
				
				<div class="method-heading attribute-method-heading">
					<span class="method-name">host</span><span
						class="attribute-access-type">[RW]</span>
				</div>

				<div class="method-description">
				
				
				
				</div>
			</div>
			
		</div>
		

		<!-- Methods -->
		
		<div id="public-class-method-details" class="method-section section">
			<h3 class="section-header">Public Class Methods</h3>

		
			<div id="new-method" class="method-detail ">
				<a name="method-c-new"></a>

				<div class="method-heading">
				
					<span class="method-name">new</span><span
						class="method-args">(protocol, host, port)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Construtor.
</p>
<ul>
<li><p>
<tt>protocol</tt> - String do protocolo a usar no DRuby.
</p>
</li>
<li><p>
<tt>host</tt> - Host sobre o qual esta rodando.
</p>
</li>
<li><p>
<tt>port</tt> - Porta a conectar.
</p>
</li>
</ul>
					

					
					<div class="method-source-code"
						id="new-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 14</span>
14:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">protocol</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>)
15:     <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
16:     <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
17:     <span class="ruby-keyword kw">begin</span>
18:       <span class="ruby-ivar">@drb_object</span> = <span class="ruby-constant">DRbObject</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-node">&quot;#{protocol}://#{host}:#{port}&quot;</span>)
19:       <span class="ruby-ivar">@node_id</span> = <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">node_id</span>
20:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
21:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Init: ConnectionFail&quot;</span>)
22:     <span class="ruby-keyword kw">end</span>
23:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="find-successor-method" class="method-detail ">
				<a name="method-i-find_successor"></a>

				<div class="method-heading">
				
					<span class="method-name">find_successor</span><span
						class="method-args">(id)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="find-successor-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 45</span>
45:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_successor</span>(<span class="ruby-identifier">id</span>)
46:     <span class="ruby-keyword kw">begin</span>
47:       <span class="ruby-identifier">ping</span>
48:       <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">find_successor</span>(<span class="ruby-identifier">id</span>)
49:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
50:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Find Successor: ConnectionFail&quot;</span>)
51:     <span class="ruby-keyword kw">end</span>
52:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="get-item-method" class="method-detail ">
				<a name="method-i-get_item"></a>

				<div class="method-heading">
				
					<span class="method-name">get_item</span><span
						class="method-args">(key)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="get-item-source">
<pre>
     <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 100</span>
100:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_item</span>(<span class="ruby-identifier">key</span>)
101:     <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">get_item</span>(<span class="ruby-identifier">key</span>)
102:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="get-pred-list-method" class="method-detail ">
				<a name="method-i-get_pred_list"></a>

				<div class="method-heading">
				
					<span class="method-name">get_pred_list</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="get-pred-list-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 70</span>
70:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_pred_list</span>
71:     <span class="ruby-keyword kw">begin</span>
72:       <span class="ruby-identifier">ping</span>
73:       <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">get_pred_list</span>
74:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
75:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
76:       <span class="ruby-comment cmt">#puts &quot;Exception =&gt; Get Pred List&quot;</span>
77:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Get Pred List: ConnetionFail&quot;</span>)
78:     <span class="ruby-keyword kw">end</span>
79:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="get-succ-list-method" class="method-detail ">
				<a name="method-i-get_succ_list"></a>

				<div class="method-heading">
				
					<span class="method-name">get_succ_list</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="get-succ-list-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 54</span>
54:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_succ_list</span>
55:     <span class="ruby-keyword kw">begin</span>
56:       <span class="ruby-identifier">ping</span>
57:       <span class="ruby-comment cmt">#como o primeiro sucessor no create eh o proprio node tenho que testar se os parametros sao validos</span>
58:       <span class="ruby-identifier">successors</span> = <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">get_succ_list</span> 
59:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">successors</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">host</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'localhost'</span>
60:         <span class="ruby-identifier">successors</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">host</span> = <span class="ruby-ivar">@host</span>
61:       <span class="ruby-keyword kw">end</span>
62:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">successors</span>
63:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
64:       <span class="ruby-keyword kw">return</span> []
65:       <span class="ruby-comment cmt">#puts &quot;Exception =&gt; Get Succ List&quot;</span>
66:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Get Succ List: ConnectionFail&quot;</span>)
67:     <span class="ruby-keyword kw">end</span>
68:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="insert-item-method" class="method-detail ">
				<a name="method-i-insert_item"></a>

				<div class="method-heading">
				
					<span class="method-name">insert_item</span><span
						class="method-args">(key, value)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="insert-item-source">
<pre>
     <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 104</span>
104:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert_item</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
105:     <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">insert_item</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
106:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="join-method" class="method-detail ">
				<a name="method-i-join"></a>

				<div class="method-heading">
				
					<span class="method-name">join</span><span
						class="method-args">(node)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="join-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 35</span>
35:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-identifier">node</span>)
36:     <span class="ruby-keyword kw">begin</span>
37:       <span class="ruby-identifier">ping</span>
38:       <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">node</span>)
39:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
40:       <span class="ruby-comment cmt">#puts &quot;Exception =&gt; Join&quot;</span>
41:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Join: ConnectionFail&quot;</span>)
42:     <span class="ruby-keyword kw">end</span>
43:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="notify-method" class="method-detail ">
				<a name="method-i-notify"></a>

				<div class="method-heading">
				
					<span class="method-name">notify</span><span
						class="method-args">(node)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="notify-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 25</span>
25:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notify</span>(<span class="ruby-identifier">node</span>)
26:     <span class="ruby-keyword kw">begin</span>
27:       <span class="ruby-identifier">ping</span>
28:       <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">notify</span>(<span class="ruby-identifier">node</span>)
29:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
30:       <span class="ruby-comment cmt">#puts &quot;Exception =&gt; Notify&quot;</span>
31:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Notify: ConnectionFail&quot;</span>)
32:     <span class="ruby-keyword kw">end</span>
33:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="ping-method" class="method-detail ">
				<a name="method-i-ping"></a>

				<div class="method-heading">
				
					<span class="method-name">ping</span><span
						class="method-args">()</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="ping-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 89</span>
89:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ping</span>
90:     <span class="ruby-keyword kw">begin</span>
91:       <span class="ruby-identifier">ok</span> = <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">ping</span>
92:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ok</span>
93:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
94:       <span class="ruby-comment cmt">#puts &quot;DENTRO DO PING&quot;</span>
95:       <span class="ruby-comment cmt">#puts &quot;#{e.class} : #{e.message}&quot;</span>
96:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
97:     <span class="ruby-keyword kw">end</span>
98:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="remove-item-method" class="method-detail ">
				<a name="method-i-remove_item"></a>

				<div class="method-heading">
				
					<span class="method-name">remove_item</span><span
						class="method-args">(key)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="remove-item-source">
<pre>
     <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 108</span>
108:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_item</span>(<span class="ruby-identifier">key</span>)
109:     <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">remove_item</span>(<span class="ruby-identifier">key</span>)
110:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="update-succ-list-method" class="method-detail ">
				<a name="method-i-update_succ_list"></a>

				<div class="method-heading">
				
					<span class="method-name">update_succ_list</span><span
						class="method-args">(successors)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					
					

					
					<div class="method-source-code"
						id="update-succ-list-source">
<pre>
    <span class="ruby-comment cmt"># File remotevirtualnode.rb, line 81</span>
81:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_succ_list</span>(<span class="ruby-identifier">successors</span>)
82:     <span class="ruby-keyword kw">begin</span>
83:       <span class="ruby-ivar">@drb_object</span>.<span class="ruby-identifier">update_succ_list</span>(<span class="ruby-identifier">successors</span>)
84:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span> 
85:       <span class="ruby-identifier">raise</span>(<span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbError</span>, <span class="ruby-value str">&quot;Update Succ List: ConnectionFail&quot;</span>)
86:     <span class="ruby-keyword kw">end</span>
87:   <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

